<?php

require_once('mysql_table.php');

class familia extends mysql_table {

  function __construct() {
    parent::__construct();
    $this->TableName = "FAMILIAS";
    $this->IDField = "ID";

    $this->fields['ID'] = "";
    $this->fields['NOMBRE'] = "";
    $this->fields['DESCRIPCION'] = "";
    $this->fields['UNIDAD'] = "";
    $this->fields['ORDEN'] = "";
    $this->fields['ID_STATUS'] = "";
  }

  /*
   * @return los activos
   * */

  function buscar() {

    $query = "SELECT * FROM " . $this->TableName . " WHERE ID_STATUS=1 ORDER BY ID DESC";
    $salida = $this->tovector_assoc_query($query);
    //print($query);
    return $salida;
  }

  function unique($Column, $Value) {
    $query = "SELECT * FROM " . $this->TableName . " WHERE " . $Column . "=" . $Value . " AND ID_STATUS=1";
    $result = $this->runquery($query);
    //print_r($query);
    if ($this->SQLObject->num_rows($result) == 0) {
      return false;
    } else {
      $this->getdata($result);
      return true;
    }
  }

}

?>
